import mpx, { createApp, ref } from '@mpxjs/core'
import apiProxy from '@mpxjs/api-proxy'
import { CDN_HOST, CLOUD_ENV } from './config'
import { createPinia } from '@mpxjs/pinia'
import { useAppStore } from './store'

const pinia = createPinia()
mpx.use(pinia)

mpx.use(apiProxy, { usePromise: true })

createApp({
  onLaunch() {
    //
    wx.cloud.init({
      env: CLOUD_ENV,
      traceUser: true
    })
    const appStore = useAppStore()
    appStore.setup()
  }
})
